<template>
  <el-popover
    placement="top"
    title=""
    width="300"
    ref="myPopover"
    trigger="click"
  >
    <div style="display: flex">
    <el-select v-model="input" placeholder="请选择">
      <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
      </el-option>
    </el-select><el-button @click="changeValue" style="margin-left: 10px" plain type="primary">确定</el-button>
    </div>
    <el-button
      type="text"
      size="mini"
      icon="el-icon-edit"
      slot="reference"
    ></el-button>
  </el-popover>
</template>
<script>
export default {
  name:"EditSelectCell",
  props: {
    id: {
      type: Number,
      default: 0
    },
    value: {
      type: Number,
      default: 0
    },
    options:{
      type:Array,
      default:function () {
        return []
      }
    }
  },
  data() {
    return {
      input: this.value
    };
  },
  watch: {
    switchValue(val) {
      this.input = val;
    }
  },
  methods: {
    changeValue() {
      this.$refs["myPopover"].doClose();
      this.$emit("change", { id: this.id, value: this.input });
    }
  }
};
</script>
